package com.yz.jdd.widget;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yz.jdd.R;

public class BottomDialog extends Dialog {
    private LinearLayout llPhone;

    public BottomDialog(Context context) {
        super(context, R.style.Cate_Dialog);
        init();
    }

    private void init() {
        setContentView(R.layout.dialog_bottom_dial);
        Window window = getWindow();
        if (window != null) {
            window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
            window.setGravity(Gravity.BOTTOM);
        }

        // 获取布局中的组件
        TextView cancelButton = findViewById(R.id.cancelButton);
        // 设置取消按钮点击事件
        cancelButton.setOnClickListener(v -> dismiss());
    }

    public void setConfirmListener(View.OnClickListener listener) {
        llPhone = (LinearLayout) findViewById(R.id.ll_phone);
        llPhone.setOnClickListener(listener);
    }

    // 设置电话号码
    public void setPhoneNumber(String phoneNumber) {
        TextView phoneTextView = findViewById(R.id.phoneTextView);
        phoneTextView.setText(phoneNumber);
    }
}
